﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls;
using Silvermoon.Controls.Interfaces;
using Silvermoon.Animations;
using Silvermoon.Core;
using Silvermoon.Controls.Classes;

namespace Silvermoon.Controls.Base
{
    public abstract class DialogBase : FormBase, IForm, ICompositeControl
    {
        public const int DefaultDuration = 375;

        private DialogControlCollection controls;

        public DialogBase()
            : base()
        {
            controls = new DialogControlCollection(this);

            // fill the complete screen by default:
            Margin = new Margin(0);

            HideTransition = TransitionMode.FadeOut;
        }

        /// <summary>
        /// Gets or sets the transition when the dialog hides.
        /// </summary>
        public TransitionMode HideTransition { get; set; }


        public override void Show()
        {
            Show(TransitionMode.SwipeInFromBottom | TransitionMode.FadeIn);
        }

        public override void Hide()
        {
            Hide(HideTransition);
        }

        /// <summary>
        /// Gets or sets the result value for the dialog.
        /// </summary>
        public DialogResult Result { get; set; }

        #region ICompositeControl Members

        public override IList<Control> Controls { get { return controls; } }

        protected internal override IList<Control> SubControls { get { return Controls; } }

        #endregion
    }
}
